package com.thiswhyme.seata.account.controller;

import com.thiswhyme.common.response.ResponseVo;
import com.thiswhyme.seata.account.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: thiswhyme
 * @date: 2020/9/4
 */
@RestController
@RequestMapping("/account/")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @PostMapping("reduceBalance")
    public ResponseVo<Boolean> reduceBalance(@RequestParam Long userId, @RequestParam Integer price) {
        return ResponseVo.success(accountService.reduceBalance(userId, price));
    }
}
